﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Fly ajax helper demo</title>
    <style type="text/css">
        textarea
        {
            width: 90%;
            height: 150px;
        }
        
        .loading
        {
            background-image:url(lightbox-ico-loading.gif);
            background-repeat:no-repeat;
            background-position:center center ;
        }
        
        .error
        {
            background-image:url(error.png);
            background-repeat:no-repeat;
            background-position:center center ;
        }
        
         .timeout
        {
            background-image:url(timeout.png);
            background-repeat:no-repeat;
            background-position:center center ;
        }
    </style>
    <script src="../../../fly/fly.js" type="text/javascript"></script>
    <script type="text/javascript">
       
        $(function () {
            $("button").click(function () {
                var js = $(this).find("<2").find('textarea').val();
                eval(js);
                return false;
            })
        });
    </script>
</head>
<body>
    <div>
        Fly ajax helper demo<div style="width:40px;height:40px" id='loadingBox' ></div></div>
    <table width="100%">
        <tr>
            <td>
                <textarea>
                var helper=new fly.ajax.Helper({
                    url:'load.aspx?a',
                    method:'get',
                    loading:{
                        css: 'loading',
                        box:'#loadingBox'
                    },
                    stop:function(conn,option){
                            alert(option.status)
                        }
                    })
                helper.go();
                </textarea>
            </td>
            <td>
                <button>
                    Call</button>
            </td>
        </tr>
        <tr>
            <td>
                <textarea>
                 var helper=new fly.ajax.Helper({
                    url:'load.aspx?error=1',
                    method:'get',
                    loading:{
                        css: {
                            start:'loading',
                            error:'error',
                            timeout:'timeout'
                        },
                        box:'#loadingBox'
                    },
                    stop:function(conn,option){
                            alert(option.status)
                        }
                    })
                    helper.go();
                </textarea>
            </td>
            <td>
                <button>
                    Call</button>
            </td>
        </tr>
        <tr>
            <td>
                <textarea>
                 var helper=new fly.ajax.Helper({
                    url:'load.aspx?timeout=1',
                    timeout:3000,
                    method:'get',
                    loading:{
                        css: {
                            start:'loading',
                            error:'error',
                            timeout:'timeout'
                        },
                        box:'#loadingBox'
                    },
                    stop:function(conn,option){
                            alert(option.status)
                        }
                    })
                    helper.go();
                </textarea>
            </td>
            <td>
                <button>
                    Call</button>
            </td>
        </tr>
        
    </table>
</body>
</html>
